package com.assembler.app.debruij.model;

/**
 * This class represents the node for the De Bruijn Graph.
 * 
 * This class is a part of the lab rotation project for PhD  students in January 2014.
 * School of Computing
 * National University Singapore.
 * 
 * @author Iana Pyrogova, Abha Belorkar
 * @version 1.0.1
 */
public class Node {

	private String node;

	public Node(String node) {
		this.node = node;
	}

	public String getNode() {
		return node;
	}

	public void setNode(String node) {
		this.node = node;
	}

	public String getPrefix() {
		return node.substring(0, node.length() - 1);
	}

	public String getSufix() {
		return node.substring(1);

	}

	@Override
	public String toString() {
		return "Node [node=" + node + "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((node == null) ? 0 : node.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Node other = (Node) obj;
		if (node == null) {
			if (other.node != null)
				return false;
		} else if (!node.equals(other.node))
			return false;
		return true;
	}
}
